/**
 * Created by Cameron on 2/6/14.

 Diamond with Name
 Given a number n, print a centered diamond with your name in place of the middle line. Example for n=3:

  *
 ***
 Bill
 ***
  *

 */
public class Diamond_With_Name_Drawer {
    void draw_diamond_with_name(int n, String name) {
        n--;
        // Draw an isosceles triangle first
        for(int i=0; i < n; i++) {
            // print spaces
            for(int j = (n+1)-i-1; j>0; j--) {
                System.out.print(" ");
            }
            // print asterixes
            for(int j=0; j < i*2 + 1; j++) {
                System.out.print("*");
            }
            System.out.println();
        }
        System.out.println(name);
        // Now draw an upside down isosceles triangle
        for(int i=0; i<n; i++) {
            // print spaces
            for(int j = 0; j < i+1; j++) {
                System.out.print(" ");
            }
            // print asterixes
            for(int j=0; j < (n-i)*2 - 1; j++) {
                System.out.print("*");
            }
            System.out.println();
        }
        System.out.println();
    }

    public static void main(String[] args) {
        Diamond_With_Name_Drawer diamond_drawer = new Diamond_With_Name_Drawer();
        diamond_drawer.draw_diamond_with_name(3, "Cameron");
        diamond_drawer.draw_diamond_with_name(4, "Rowshanbin");
    }
}
